package controller

import (
	"fmt"
	"github.com/gogf/gf/frame/g"
	"github.com/gogf/gf/net/ghttp"
	"web/app/dao/db_repo"
	_ "web/app/dbo"
	UserModel "web/app/system/model/user"
)

func init() {
	s := g.Server()
	s.BindHandler("/userUms", findUserByName)
}

var UmsUser = umsUserApi{}

type umsUserApi struct{}

func (*umsUserApi) Index(r *ghttp.Request) {
	user := UserModel.NewQueryBuilder()
	listData := user.WhereName(db_repo.LikePredicate, "黄加林")
	fmt.Println(listData)
	fmt.Println(user)
	fmt.Printf("%#v\n", user)
	r.Response.Writeln("Hello World!")
}

func findUserByName(r *ghttp.Request) {
	user := UserModel.NewQueryBuilder().WhereName(db_repo.EqualPredicate, "黄加林")
	fmt.Printf("%#v\n", user)
	r.Response.Writeln("查询成功!")
}
